import java.util.Arrays;

public class Test {
    public static int[] fun(int[] nums, int target) {
        int[] arrays = new int[2];
        //趟数
        for (int i = 0; i < nums.length - 1; i++) {
            for (int j = 1; j < nums.length - 1 - i; j++) {
                if (nums[i] + nums[i + j] == target) {
                    arrays[0] = i;
                    arrays[1] = i + j;
                    return arrays;
                }
            }
        }
        return null;
    }
    public static void main(String[] args) {
        int[] nums=new int[]{2,31,4,5,7,3,5};
        int[] arrays=fun(nums,36);
        String ret = Arrays.toString(arrays);
        System.out.println(ret);
    }
}
